import Vue from 'vue';
import Router from 'vue-router';



Vue.use(Router);

export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件' },
            children: [
                // 二级路由里边路由懒加载  需要跟路由配置跟实际路由跳转需要一一对应匹配 报错
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
                    meta: { title: '系统首页' }
                },
                {
                    path: '/icon',
                    component: () => import(/* webpackChunkName: "icon" */ '../components/page/Icon.vue'),
                    meta: { title: '自定义图标' }
                },
                {
                    path: '/table',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/BaseTable.vue'),
                    meta: { title: '基础表格' }
                },
                {
                    path: '/tabs',
                    component: () => import(/* webpackChunkName: "tabs" */ '../components/page/Tabs.vue'),
                    meta: { title: 'tab选项卡' }
                },
                {
                    path: '/form',
                    component: () => import(/* webpackChunkName: "form" */ '../components/page/BaseForm.vue'),
                    meta: { title: '基本表单' }
                },
                {
                    // 富文本编辑器组件
                    path: '/editor',
                    component: () => import(/* webpackChunkName: "editor" */ '../components/page/VueEditor.vue'),
                    meta: { title: '富文本编辑器' }
                },
                {
                    // markdown组件
                    path: '/markdown',
                    component: () => import(/* webpackChunkName: "markdown" */ '../components/page/Markdown.vue'),
                    meta: { title: 'markdown编辑器' }
                },
                {
                    // 图片上传组件
                    path: '/upload',
                    component: () => import(/* webpackChunkName: "upload" */ '../components/page/Upload.vue'),
                    meta: { title: '文件上传' }
                },
                {
                    // vue-schart组件
                    path: '/charts',
                    component: () => import(/* webpackChunkName: "chart" */ '../components/page/BaseCharts.vue'),
                    meta: { title: 'schart图表' }
                },
                {
                    // 拖拽列表组件
                    path: '/drag',
                    component: () => import(/* webpackChunkName: "drag" */ '../components/page/DragList.vue'),
                    meta: { title: '拖拽列表' }
                },
                {
                    // 拖拽Dialog组件
                    path: '/dialog',
                    component: () => import(/* webpackChunkName: "dragdialog" */ '../components/page/DragDialog.vue'),
                    meta: { title: '拖拽弹框' }
                },
                {
                    // 国际化组件
                    path: '/i18n',
                    component: () => import(/* webpackChunkName: "i18n" */ '../components/page/I18n.vue'),
                    meta: { title: '国际化' }
                },
                {
                    // 权限页面
                    path: '/permission',
                    component: () => import(/* webpackChunkName: "permission" */ '../components/page/Permission.vue'),
                    meta: { title: '权限测试', permission: true }
                },
                {
                    path: '/404',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
                    meta: { title: '404' }
                },
                {
                    path: '/403',
                    component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
                    meta: { title: '403' }
                },
                {
                    path: '/donate',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/page/Donate.vue'),
                    meta: { title: '支持作者' }
                },
                {
                    path: '/home',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/Home.vue'),
                    meta: { title: '主页' }
                },
                {
                    path: '/user',
                    name: 'users',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/users/users.vue'),
                    meta: { title: '用户管理', requireAuth:true }
                },
                {
                    path: '/product',
                    name: 'product',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/Product/product.vue'),
                    meta: { title: '商品管理', requireAuth:true }
                },
                {
                    path: '/cate',
                    name: 'cate',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/cate/cate.vue'),
                    meta: { title: '品类管理', requireAuth:true }
                },
                {
                    path: '/addcate',
                    name: 'addcate',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/cate/addcate.vue'),
                    meta:{
                      title:"添加品类",
                      requireAuth:true
                    },
                },
                {
                    path: '/showcateItem',
                    name: 'cateItem',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/cate/cateItem.vue'),
                    meta:{
                      title:"查看子品类",
                      requireAuth:true
                    },
                  },
                {
                    path: '/addProduct',
                    name: 'addProduct',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/Product/addProduct.vue'),
                    meta:{
                      title:"添加商品",
                      requireAuth:true
                    },
                },
                {
                    path: '/productDetail',
                    name: 'productDetail',
                    component:  () => import(/* webpackChunkName: "donate" */ '../components/Product/productDetail.vue'),
                    meta:{
                      title:"商品详情",
                      requireAuth:true
                    },
                },
                {
                    path: '/updataProduct',
                    name: 'updataProduct',
                    component:  () => import(/* webpackChunkName: "donate" */ '../components/Product/updataProduct.vue'),
                    meta:{
                      title:"商品编辑",
                      requireAuth:true
                    },
                },
                {
                    path: '/order',
                    name: 'order',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/order/order.vue'),
                    meta:{
                      title:"订单管理",
                      requireAuth:true
                    },
                },
                {
                    path: '/orderdetail',
                    name: 'orderdetail',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/order/orderdetail.vue'),
                    meta:{
                      title:"订单详情",
                      requireAuth:true
                    },
                },
                {
                    path: '/baitest',
                    name: 'baitest',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/baimap/baitest.vue'),
                    meta:{
                      title:"百度地图Demo",
                      requireAuth:true
                    },
                },
                {
                    path: '/baimap',
                    name: 'baimap',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/baimap/baimap.vue'),
                    meta:{
                      title:"百度地图实例",
                      requireAuth:true
                    },
                },
                {
                    path: '/echarts',
                    name: 'echarts',
                    component: () => import(/* webpackChunkName: "donate" */ '../components/echarts/echarts.vue'),
                    meta:{
                      title:"echarts图表",
                      requireAuth:true
                    },
                },
            ]
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: '登录' }
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
